<?php
// 发表评论
// header("content-type:text/html;charset=utf-8");
include_once("conn.php");

$uid = $_POST['uid'];
//商品gid编号
$g_id = $_POST['g_id'];

$remark = $_POST['remark'];

$way = $_POST['way'];
//时区设置为中国
date_default_timezone_set('PRC');
$remark_time = date('Y-m-d H:i:s');

$sql = "INSERT INTO tb_remark_info (uid,g_id,content,r_date) values ('".$uid."','".$g_id."','".$remark."','".$remark_time."')";
$result = mysqli_query($conn,$sql);

if($result){
    if ($way == "2"){
        $cid = $_POST['cid'];
        echo "<script>location.href='../u_show_cart_goods.php?id=".$cid."';</script>";
    }else{
        echo "<script>location.href='../u_show_goods.php?g_id=".$g_id."';</script>";
    }
}else{
    echo "<script>alert('发表失败请重试！');history.go(-1);</script>";
}